#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
void leftround(char* arr,int k)
{
	int len = strlen(arr);
	int i = 0;
	int time = k & len;
	
	for (i = 0; i < time; i++)
	{
		char tmp = *arr;
		int j = 0;
		for (j = 0; j < len - 1; j++)
		{
			*(arr + j ) = *(arr + j+1);
		}
		*(arr+len-1) = tmp;
	}

}
void leftround1(char* arr, int k)
{
	char arr2[256] = { 0 };
	int len = strlen(arr);
	int time = k % len;
	strcpy(arr2, arr+time);
	strncat(arr2, arr, time);
	strcpy(arr, arr2);
}
void reverse(char* arr, int left, int right)
{
	char tmp = 0;
	while (left < right)
	{
		tmp = *(arr + left);
		*(arr + left) = *(arr + right);
		*(arr + right) = tmp;
		left++;
		right--;
	}
}
void leftround2(char* arr, int k)
{

	int right = strlen(arr) ;
	int time = k % right;
	reverse(arr, time, right - 1);
	reverse(arr, 0, time - 1);
	reverse(arr, 0, right - 1);
}
int main()
{
	char arr[] = "abcdef";
	//leftround(arr,2);
	//leftround1(arr, 2);
	leftround2(arr, 2);
	printf("%s", arr);
	return 0;
}